import process from 'node:process'
import { defineUniPages } from '@uni-helper/vite-plugin-uni-pages'
import { loadEnv } from 'vite'

const env = loadEnv(process.env.NODE_ENV, process.cwd())
const { VITE_APP_TITLE } = env

export default defineUniPages({
  easycom: {
    autoscan: true, // 是否自动扫描组件
    custom: {
      '^(?!z-paging-refresh|z-paging-load-more)z-paging(.*)': 'z-paging/components/z-paging$1/z-paging$1.vue',
    },
  },
  pages: [],
  subPackages: [],
  preloadRule: {},
  globalStyle: {
    'navigationBarBackgroundColor': '#FFFFFF',
    'backgroundColor': '#FFFFFF',
    'navigationBarTextStyle': 'black',
    'navigationBarTitleText': VITE_APP_TITLE,
    // 横屏配置，全局屏幕旋转设置(仅 APP/微信/QQ小程序)，支持 auto / portrait / landscape
    'pageOrientation': 'portrait',
    'app-plus': {
      softinputNavBar: 'none',
      bounce: 'none',
      titleNView: false, // 移除 H5、APP 顶部导航
    },
    'mp-alipay': {
      allowsBounceVertical: 'NO',
    },
    'h5': {
      titleNView: false, // 移除 H5、APP 顶部导航
    },
  },
  tabBar: {
    color: '#86909C',
    selectedColor: '#165DFF',
    backgroundColor: '#FFFFFF',
    height: '0',
    list: [
      {
        pagePath: 'pages/home/index',
      },
      {
        pagePath: 'pages/main/index',
      },
    ],
  },
})
